π¦ Resize Root Disk on AWS EC2 (30 GB β 50 GB)
This guide explains how to increase disk size on an AWS EC2 instance when the disk is full and ensure the OS recognizes the new space.
π’ Step 1: Modify EBS Volume from AWS Consoleβ
- Go to AWS EC2 Console
- Navigate to EC2 β Volumes
- Select the attached root volume
- Click Modify volume
- Change the size from 30 GB to 50 GB
- Click Modify and confirm
β³ Wait until the Volume State becomes in-use again.
π’ Step 2: Verify Disk Size on Serverβ
Login to the EC2 instance and check disk usage:
df -h
You will still see the old filesystem size, for example:
Filesystem Size Used Avail Use% Mounted on
/dev/root 29G 9.2G 19G 33% /
This is expected because only the volume was resized, not the partition or filesystem.
π’ Step 3: Check Block Devicesβ
lsblk
Output (volume resized, partition not yet):
nvme0n1 259:0 0 50G 0 disk
ββnvme0n1p1 259:1 0 29G 0 part /
π Here, the disk is 50 GB, but the root partition is still 29 GB.
π’ Step 4: Install Required Utilitiesβ
Install cloud utilities required to grow partitions:
sudo apt update
sudo apt install cloud-guest-utils -y
π’ Step 5: Grow the Root Partitionβ
Extend partition 1 of disk nvme0n1:
sudo growpart /dev/nvme0n1 1
Verify again:
lsblk
Expected output:
nvme0n1 259:0 0 50G 0 disk
ββnvme0n1p1 259:1 0 49G 0 part /
β Partition is now resized.
π’ Step 6: Resize the Filesystem (IMPORTANT β οΈ)β
Even after growing the partition, the filesystem still uses the old size. Resize it using:
sudo resize2fs /dev/nvme0n1p1
π’ Step 7: Final Verification πβ
df -h
Expected output:
Filesystem Size Used Avail Use% Mounted on
/dev/root 49G 9.2G 38G 20% /
π Disk space successfully increased from 30 GB to 50 GB!
π§ Key Notesβ
- π‘ Volume resize β filesystem resize
- π‘ Always run
growpart+resize2fs - π‘ No reboot required in most cases
- π’ Works for ext4 filesystems (default Ubuntu)
π One-Line Summaryβ
Modify volume β grow partition β resize filesystem π